#pragma once

#include "Node.h"


namespace uml {

Node::Node(const QString& umlType)
    : Class(umlType) {}

void Node::fromJson(const QJsonObject& json, QStringList& errorList) {
    if (json.isEmpty()) {
        return;
    }

    DeploymentTarget::fromJson(json, errorList);
    Class::fromJson(json, errorList);
    JsonSerializable::fromJsonArray(nestedNodes_, "nestedNodes", json, errorList);
}

void Node::toJson(QJsonObject& json) {
    DeploymentTarget::toJson(json);
    Class::toJson(json);
    JsonSerializable::toJsonArray(nestedNodes_, "nestedNodes", json);
}

/// <summary>
/// nestedNodes getter
/// The Nodes that are defined (nested) within the Node.
/// </summary>
vector<shared_ptr<Node>>& Node::nestedNodes() {
    return nestedNodes_;
}

} // namespace uml
